<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="format-detection" content="address=no">
    <meta name="format-detection" content="email=no">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <title>竞猜收盘价</title>
    <link rel="stylesheet" href="<?php echo C('STATIC_SHORT_URL');?>/mobile/css/guess.css?v=1.6">
    <style type="text/css">
        #message {
            position: fixed;
            width: 100%;
            top: 50%;
            text-align: center;

            color: red;
            left: 50%;
            -webkit-transform: translate(-50%,-50%);
            z-index: 99999999;
            font-size: 0.8rem;
        }
        #message div {
            background: rgba(225,225,225,0.8);
            display: inline-block;
            text-align: center;
            padding: 0.5rem 1rem;
            border-radius: 0.1rem;
        }
    </style>
</head>
<body>
<!--内容部分-->
<img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/1.jpg?v=1.0'?>" style="width: 100%;display: block ; ">
    <!--显示当前次数-->
 <div style="position: relative;top:0;width:100%;margin-top: -1px;" >
     <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/2.jpg?v=1.0'?>" style="width: 100%; ">
     <p class="txt">你当前剩余<span class="number"><?php echo $rest_count;?></span>次竞猜机会</p>
</div>
    <!--哈贵镍-->
<div class="part click">
    <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/part11.jpg'?>" alt="" width="100%">
    <div class="center">
        <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/left1.png'?>" alt="" width="100%" class="img">
        <!--进度条-->
        <div class="out">
            <div class="in in1"></div>
        </div>
        <!--点击参与-->
        <div class="btn1" id="t1">
            <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/btn1.png'?>" alt="" width="100%">
        </div>
    </div>
</div>
    <!--哈贵银-->
<div class="part click">
    <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/part22.jpg'?>" alt="" width="100%">
    <div class="center">
        <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/left2.png'?>" alt="" width="100%" class="img">
        <!--进度条-->
        <div class="out">
            <div class="in in2"></div>
        </div>
        <!--点击参与-->
        <div class="btn1">
            <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/btn1.png'?>" alt="" width="100%">
        </div>
    </div>
</div>
    <!--广贵银-->
<div class="part click">
    <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/part33.jpg'?>" alt="" width="100%">
    <div class="center">
        <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/left3.png'?>" alt="" width="100%" class="img">
        <!--进度条-->
        <div class="out">
            <div class="in in3"></div>
        </div>
        <!--点击参与-->
        <div class="btn1">
            <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/btn1.png'?>" alt="" width="100%">
        </div>
    </div>
</div>
    <!--吉咖啡-->
<div class="part click">
    <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/part44.jpg'?>" alt="" width="100%">
    <div class="center">
        <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/left4.png'?>" alt="" width="100%" class="img">
        <!--进度条-->
        <div class="out">
            <div class="in in4"></div>
        </div>
        <!--点击参与-->
        <div class="btn1">
            <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/btn1.png'?>" alt="" width="100%">
        </div>
    </div>
</div>
<!--我的精彩记录和获奖名单-->
<div class="btn23">
    <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/3.jpg'?>" alt="" width="100%">
    <!--我的竞猜记录-->
    <div id="my" >
        <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/btn2.png'?>" alt="" width="100%">
    </div>
    <!--获奖名单-->
    <a href="#"  id="name" >
        <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/btn3.png'?>" alt="" width="100%">
    </a>
</div>
<img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/4.jpg?v=1.0'?>" style="width: 100%;display: block ; ">
<img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/5.jpg?v=1.0'?>" style="width: 100%;display: block ; ">
<!--6个弹窗-->
<div id="top" style="display: none" >
    <!--竞猜弹窗-->
    <div class="success on public" style="display: none" id="write" >
        <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/write.png?v=1.0'?>" style="width: 100%;display: block ; ">
        <!--交易所-->
        <div class="guess_txt">
            <p class="p1"><span class="guess_type">广贵银</span>收盘价格</p>
            <p class="p2">昨日收盘价为： <span class="guess_price">3467</span></p>
            <!--输入框-->
            <input type="text" class="check" name="test" placeholder="请输入你的竞猜价格" value=""  >
        </div>
        <div class="read read2 public2">
            <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/btn4.png?v=1.0'?>" style="width: 100%;display: block ; ">
        </div>
        <div id="close" style='width:2rem;text-align:center;height: 2rem;line-height: 2rem;z-index: 3;font-size:2rem;color:#FFF;position:absolute;top:0;right:0;border:1px solid #FFF;border-radius:50%;'>X</div>
    </div>
    <!--提交成功-->
    <div class="success public" style="display: none" id="success" >
        <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/success.png?v=1.0'?>" style="width: 100%;display: block ; ">
        <div class="read  read3 public2">
            <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/red.png?v=1.0'?>" style="width: 100%;display: block ; ">
        </div>
    </div>
    <!--竞猜次数不足-->
    <div class="notEnough public" style="display: none" >
        <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/not_enough.png?v=1.0'?>" style="width: 100%;display: block ; ">
        <a href="honglu://www.honglu.com/native?name=home&index=1"  class="go public2">
            <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/go.png?v=1.0'?>" style="width: 100%;display: block ; ">
        </a>
    </div>
    <!--竞猜时间已过-->
    <div class="timeOut public" style="display: none" >
        <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/time_out.png?v=1.0'?>" style="width: 100%;display: block ; ">
        <div class="read read3 public2">
            <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/red.png?v=1.0'?>" style="width: 100%;display: block ; ">
        </div>
    </div>
    <!--来早,还未公布获奖名单-->
    <div class="sorry public" style="display: none" >
        <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/time.png?v=1.0'?>" style="width: 100%;display: block ; ">
        <div class="read read3 public2">
            <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/red.png?v=1.0'?>" style="width: 100%;display: block ; ">
        </div>
    </div>
    <!--我的竞猜记录-->
    <div class="record public" style="display: none;height:21.344rem" >
        <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/record.png?v=1.0'?>" style="width: 100%;display: block ; ">
        列表
        <div id="list">
            <div id="list_contain">
                <?php if($list_mine){ foreach($list_mine as $val){ ?>
                <div class="list_public">
                    <p class="time">
                        <span class="day"><?php echo date('d日 H:i',$val['add_time']);?></span>
                    </p>
                    <p class="type"><?php if($val['type'] == 4){echo '哈贵镍';}elseif($val['type'] == 5){echo '哈贵银';}elseif($val['type'] == 6){echo '广贵银';}elseif($val['type'] == 7){echo '吉咖啡';}?></p>
                    <p class="price_over"><?php echo $val['analyst_type'];?></p>
                </div>
                <?php }}else{ ?>
                <p class="type1" style="width: 100%;text-align: center;color: red;font-size:1rem;line-height: 10rem;">您还没有竞猜记录哦！</p>
                <?php }?>
            </div>

        </div>
        <div class="read read3 public2" style="bottom:5%"  >
            <img src="<?php echo C('STATIC_SHORT_URL') . '/mobile/images/activity/guess/red.png?v=1.0'?>" style="width: 100%;display: block ; ">
        </div>
    </div>
</div>
<!--提示弹窗-->
<div id="message" style="display: none">
    <div>1111</div>
</div>
<script src="<?php echo C('STATIC_SHORT_URL');?>/mobile/js/jquery-1.7.1.js"></script>
<script>
    $(function(){
        var ready=true;
        var index = 0;
        var type = 0;
        var arr=[
            {"type":"4","name":"哈贵镍","priceEnd":"<?php echo $price_1;?>"},
            {"type":"5","name":"哈贵银","priceEnd":"<?php echo $price_2;?>"},
            {"type":"6","name":"广贵银","priceEnd":"<?php echo $price_3;?>"},
            {"type":"7","name":"吉咖啡","priceEnd":"<?php echo $price_4;?>"}
        ];
//        var price = '<?php echo $price;?>';
     
//        我的猜价
      

//        点击竞猜
        $(".btn1") .on('touchstart touchmove touchend', function(event) {
            switch(event.type) {
                case 'touchstart':
                    falg = false;
                    break;
                case 'touchmove':
                    falg = true;
                    break;
                case 'touchend':
                    if( !falg ) {
                        console.log('点击');
                       
                        index=$(this).index('.btn1');
                        $('#top').show();
                        $('.on').show();
                        show();
                        for(var i=0;i<arr.length ;i++){
                            if(arr[i].type==type){
                                console.log(arr[i].type ,arr[i].name)
                                $('.guess_type').html(arr[i].name);
//                                收盘价
                                console.log(arr[i].priceEnd );
                                if( arr[i].priceEnd == 0){
                                    $('.guess_price').parent().css("visibility","hidden");
                                }
                                
                                $('.guess_price').html(arr[i].priceEnd);

                            }

                        }
                        event.stopPropagation();
                        return false;
                    } else {
                        console.log('滑动');
                    }
                    break;
            }
        });
        function show(){
            type=index+4;
            console.log(index,type);
        }
        show();
         $("input[name='test']").val( );
//提交
        var flag = false;
        $(".read2") .on('touchstart touchmove touchend', function(event) {
            switch(event.type) {
                case 'touchstart':
                    falg = false;
                    break;
                case 'touchmove':
                    falg = true;
                    break;
                case 'touchend':
                    if( !falg ) {
                        $(this).parent ().hide();
                        show();
                        console.log('点击',type );
                        console.log( price_guess);             
                        var type1=type;
                        var num=$(".number").html();
                     
                        var price_guess=$("input[name='test']").val();
                        var uid = <?php echo $uid;?>;
                        var url = "http://h5.518yin.com/h5/ActivityNew/guess";
                        $("input[name='test']").val( );
                        $.ajax({
                            type: 'get',
                            url: url+ '?u_userid='+uid +"&price="+price_guess +"&type="+type,
                            dataType: 'json',
                            timeout: 6000,
                            success: function(data) {
                                console.log(data);
                                //数据传递验证成功后执行的操作
                                if (data.code == 200) {
                                      console.log( num);
                                      num--;
                                      $(".number").html(num);
                                    $("#write").hide();
                                   $('#success').show();
                                    $("input[name='test']").val("");
                           
                                }else if(data.code == 203){
                                    $('.timeOut').show();
                                }else if(data.code == 207){
                                    $('.notEnough').show();
                                } else{
                                    $("#message div").html(data.msg).parent().show();
                                    setTimeout(function() {
                                        $("#message").hide();
                                        $('#top').hide();
                                    }, 1000)
                                }
                            },
                        });
                    } else {
                        console.log('滑动');
                    }
                    break;

            }
        });

        //朕已阅
        $('.read3').on("click",function(){
            $(this).parent ().hide();
            $('#top').hide();
        })
        
        
        //
        $('#close').on("click",function(){
          
            $('#top').hide();
        })
        
//未到公布时间
        var myDate = new Date();
        myDate.getTime(); //获取当前时间(从1970.1.1开始的毫秒数)
        $("#name").on("touchstart click",function(){
            console.log(myDate.getTime());
            if(myDate.getTime()<=1487642400*1000){
                $('#top').show();
                $('.sorry').show();
                $('#write').hide();
                
            }
        });
//我的竞猜记录
       
           $("#my") .on('touchstart touchmove touchend', function(event) {
            switch(event.type) {
                case 'touchstart':
                    falg = false;
                    break;
                case 'touchmove':
                    falg = true;
                    break;
                case 'touchend':
                    if( !falg ) {
                        $('#top').show();
            $('.record').show();
             $('.success').hide();
                    } else {
                        console.log('滑动');
                    }
                    break;

            }
        });
//进度条
        var div1=$('.out').width();
        var  number=<?php echo $count_total;?>;
        var  number1=<?php echo $count_guess_1;?>;
        var  number2=<?php echo $count_guess_2;?>;
        var  number3=<?php echo $count_guess_3;?>;
        var  number4=<?php echo $count_guess_4;?>;
        var _width1= parseFloat((number1/ number)*8.75).toFixed(2)+"rem";
        var _width2= parseFloat((number2/ number)*8.75).toFixed(2)+"rem";
        var _width3= parseFloat((number3/ number)*8.75).toFixed(2)+"rem";
        var _width4= parseFloat((number4/ number)*8.75).toFixed(2)+"rem";
        console.log(_width1);
        $('.in1').width(_width1);
        $('.in2').width(_width2);
        $('.in3').width(_width3);
        $('.in4').width(_width4);


//        $("#message div").html(data.msg).parent().show();
//        setTimeout(function() {
//            $("#message").hide();
//        }, 1000)




    })
</script>
<script type="text/javascript">
    // rem自适应代码
    (function (doc, win) {
        var docEl = doc.documentElement,
                resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
                recalc = function () {
                    var clientWidth = docEl.clientWidth;
                    if (!clientWidth) return;
                    docEl.style.fontSize = 16 * (clientWidth / 375) + 'px';
                };

        if (!doc.addEventListener) return;
        win.addEventListener(resizeEvt, recalc, false);
        doc.addEventListener('DOMContentLoaded', recalc, false);
    })(document, window);
</script>
</body>
</html>